package com.devehx.wallet.comm;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

import java.util.Objects;
import java.util.concurrent.TimeUnit;

public class CollectKit {

    public static Cache<String, String> cache = Caffeine.newBuilder()
            .expireAfterWrite(5, TimeUnit.MINUTES).maximumSize(100000L).build();

    public static void add(String address) {
        cache.put(address, "-");
    }

    public static boolean isOk(String address) {
        return Objects.isNull(cache.getIfPresent(address));
    }

    public static void remove(String address) {
        cache.invalidate(address);
    }


}
